<include file="Public:header"/>
	<head>
		<meta charset="UTF-8">
		<title>details</title>
		<link href="__PUBLIC__/Home/Css/foods_detail.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.8.3.js"></script>
		
		<script type="text/javascript">
		 	$(function(){
		 	/*添加到购物车Ajax*/
			$('#addCarts').click(function(){
				
				var fid = $(this).attr('alt');				
				var url = '__APP__/Carts/setCarts/';
				var nowobj = $(this);

				$.post(url,{id:fid},function(cdata){

					if('YES' == cdata.data){
	                                                	
	                                            	nowobj.text('已添加');
	                                        	}else if('NO' == cdata.data){
	                                        		nowobj.text('已存在');
	                                        	}else{
	                                        		if(!confirm('您还没有登录,去登录吗?')){
                                    				return false;
                                				}
	                                        		window.location.href = "__APP__/Login/login";
	                                        	}
				});
			});

			/*删除评论*/
			$('.delEva').click(function(){
				
				var eid = $(this).attr('alt');				
				var url = '__APP__/Foods/delEva/';
				var nowobj = $(this);

				$.post(url,{id:eid},function(cdata){

					if('YES' == cdata.data){
	                                                	
	                                            		nowobj.parent().parent().remove();
	                                        	}else{
	                                        		alert('删除评论失败!');
	                                        	}
				});
			});

			
			$('#addEva').submit(function(){
				var content = $(".evaContent").val();
				if(!content){
					alert('请输入评价内容!');	
					return false;
				}
			});

		 });

		</script>
	</head>
	<body>
		<div id="detail">
			<div id="detail_left">
				<img src="__ROOT__/Uploads/Foods/<{$data.pic}>" width="650" style="max-height:420px;">
				<div style="width:650px;float:left;">
					<a href="__APP__/Carts/showCarts/" target="_blank">
						<div class="car">查看购物车</div>
					</a>
					<a alt="<{$data.id}>" id="addCarts" class="car">
						<div>加入购物车</div>
					</a>
				</div>
				
				<div style="width:650px;float:left;color:#8B8B8B;">
					<span style="margin-left:10px;">
						好评度:<font style="color:#9C2222;font-size:14px;">
							<empty name="edata">暂无评价
							<else /> <{$edata}>
							</empty>
						</font>
					</span>
					<span style="margin-left:20px;">
						预定量:<font style="color:#9C2222;font-size:14px;"><{$f_num}>
							<empty name="f_num">0
							<else /> <{$f_num}>
							</empty>
						</font>
					</span>
				</div>
				<div style="clear:both;height:20px;"></div>
			</div>

			<div id="detail_right">

				<div id="right_top">
					<p class="pstyle">名称：
						<font style="font-size:14px;"><{$data.name}></font> 
					</p>
					<p class="pstyle">价格：
						<font style="font-size:14px;">
							<{$data.price}>￥
						<font>
					</p>
					<p class="pstyle">状态：
						<font style="font-size:14px;">
						<if condition="$data.status eq 1 ">在售
						<else /> 已下架
						</if>
						</font>
					</p>
					<span style="margin-left:10px;color:#68616D;">描述：</span>
					<font style="font-size:14px;text-indent:3em;color:#68616D;">
						<div style="margin:0px 10px;">
							<{$data.describe|substr=0,1000}>
						</div>
					</font>
				</div>
			</div>
			<div style="clear:both;height:30px;background:white;border-top:#cdcdcd 1px solid;"></div>
			<div style="width:980px;background:#FEFEFE;float:left;">
					<div>
						<span style="margin-left:10px;color:#d2beac;font-size:14px;margin-bottom:10px;">
							用户评价
						</span>
					</div>
					<div style="width:470px;float:left;margin-left:10px;">
					<volist name="ed" id="edvo">
						<if condition="$i%2 neq 0 ">
						<div class="flag">
						<div class="colorGreen"></div>
						<div class="-E">
							<p>
								<span style="color:#9C2222;">
								用户:	<{$edvo.username}>
								</span>
							</p>
							<p>
								<span style="margin-left:20px;font-size:14px;text-indent:2em;">
								内容:	<{$edvo.content}>
								</span>
							</p>
							<p>
								<span style="margin-left:20px;color:#d2beac;">
								<{$edvo.posttime}>
								</span>
							</p>
						</div>
						<div class="evaRight">
							<if condition="$Think.session.uid eq $edvo['uid']">
							<img src="__PUBLIC__/Imgs/error.png" alt="<{$edvo.id}>" title="删除" width="15" class="delEva">
							</if>
						</div>
						</div>
						</if>		
					</volist>
					</div>

					<div style="width:470px;float:right;margin-right:10px;">
					<volist name="ed" id="edvo">
						<if condition="$i%2 eq 0 ">
						<div class="flag">
						<div class="colorBlue"></div>
						<div class="-E">
							<p>
								<span style="color:#9C2222;">
								用户:	<{$edvo.username}>
								</span>
							</p>
							<p>
								<span style="margin-left:20px;font-size:14px;text-indent:2em;">
								内容:	<{$edvo.content}>
								</span>
								</p>
							<p>
								<span style="margin-left:20px;color:#d2beac;">
								<{$edvo.posttime}>
								</span>
							</p>
						</div>
						<div class="evaRight">
							<if condition="$Think.session.uid eq $edvo['uid']">
							<img src="__PUBLIC__/Imgs/error.png" alt="<{$edvo.id}>" title="删除" width="15" class="delEva">
							</if>
						</div>
						</div>
						</if>		
					</volist>
					</div>
				</div>
				<div style="height:30px;background:white;clear:both;"></div>
				<div style="width:650px;min-height:100px;float:left;">
					<form action="__APP__/Foods/evaluate" method="post" id="addEva">
						<input type="hidden" name="fid" value="<{$footsid}>">
						<!-- <font style="margin-left:10px;">评论内容</font> -->						
						<textarea name="content" class="evaContent" style="width:630px;height:100px;margin-left:10px; resize:none;margin-top:20px;"></textarea>
						<input type="submit" value="评论" style="border:none;width:120px;height:30px;background:#9C2222;margin-left:10px;margin-top:10px;margin-bottom:10px;color:white;font-size:16px;">
					</form>
				</div>
		</div>		
	</body>
</html>
<include file="Public:footer"/>